package com.glsc.ngateway.common.base.domain.mysql.opmanagemain.ledger;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.datatype.jsr310.deser.LocalDateTimeDeserializer;
import com.fasterxml.jackson.datatype.jsr310.ser.LocalDateTimeSerializer;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.format.annotation.DateTimeFormat;

import javax.persistence.*;
import java.io.Serializable;
import java.time.LocalDateTime;

/**
 * @author liwei
 * 台账权限-员工关系表
 */
@Data
@Entity
@Table(name = "t_ledger_auth_staff")
@org.hibernate.annotations.Table(appliesTo = "t_ledger_auth_staff", comment = "台账权限-员工关系表")
@JsonInclude(JsonInclude.Include.NON_NULL)
@JsonIgnoreProperties({"hibernateLazyInitializer", "handler"})
@Builder
@AllArgsConstructor
@NoArgsConstructor
public class LedgerAuthStaff implements Serializable {
    private static final long serialVersionUID = 8603653395695928797L;

    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Column(name = "id", columnDefinition = "int(20) comment 'id'")
    private Integer id;

    @ApiModelProperty(value = "台账权限id")
    @Column(name = "ledger_auth_id", columnDefinition = "int(20) comment '台账权限id'")
    private Integer ledgerAuthId;

    @Column(name = "user_id", columnDefinition = "int DEFAULT NULL COMMENT '员工id'")
    @ApiModelProperty(value = "员工id")
    private Integer userId;

    @ApiModelProperty(value = "员工名称 ")
    @Column(name = "user_name", columnDefinition = "varchar(255) COMMENT '员工名称'")
    private String userName;

    @ApiModelProperty(value = "员工oa账号")
    @Column(name = "user_oa_account", columnDefinition = "varchar(255) comment '员工oa账号'")
    private String userOaAccount;

    @ApiModelProperty(value = "备注")
    @Column(name = "memo", columnDefinition = "varchar(255) COMMENT '备注'")
    private String memo;

    @Column(name = "creator_id", columnDefinition = "int DEFAULT NULL COMMENT '创建人id'")
    @ApiModelProperty(value = "创建人id")
    private Long creatorId;

    @ApiModelProperty(value = "创建时间 yyyy-MM-dd HH:mm:ss")
    @Column(name = "create_time", columnDefinition = "datetime comment '创建时间'", updatable = false)
    @org.hibernate.annotations.CreationTimestamp
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @JsonSerialize(using = LocalDateTimeSerializer.class)
    @JsonDeserialize(using = LocalDateTimeDeserializer.class)
    private LocalDateTime createTime;


}
